using Habanero.Faces.Base;
using Habanero.Faces.Win;
using NUnit.Framework;

namespace FireStarterModeller.Test.UI
{
    [TestFixture]
    public class TestCreateControlMock
    {
        public interface IMyClassControl : IControlHabanero
        {
            void MyMethod();
        }

        public class MyMainControl : UserControlWin
        {
            internal IMyClassControl MyClassControl { get; private set; }

            public MyMainControl(IMyClassControl myClassControl)
            {
                MyClassControl = myClassControl;
                ColumnLayoutManager columnLayoutManager = new ColumnLayoutManager(this, new ControlFactoryWin());
                columnLayoutManager.AddControl(myClassControl);
            }
        }

        [Test]
        public void Test_Construct()
        {
            //---------------Set up test pack-------------------
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            IMyClassControl myClassControl = TestUtilsUI.CreateControlMock<IMyClassControl>();
            //---------------Test Result -----------------------
            MyMainControl myMainControl = new MyMainControl(myClassControl);
            Assert.AreSame(myClassControl, myMainControl.MyClassControl);
        }

        [Test]
        public void Test_Layout()
        {
            //---------------Set up test pack-------------------
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            IMyClassControl myClassControl = TestUtilsUI.CreateControlMock<IMyClassControl>();
            //---------------Test Result -----------------------
            MyMainControl myMainControl = new MyMainControl(myClassControl);
            Assert.AreSame(myClassControl, myMainControl.MyClassControl);
            Assert.IsTrue(((IControlHabanero)myMainControl).Controls.Contains(myClassControl));
        }
    }
}